package com.zekai.server.process;

import java.io.IOException;
import java.util.List;

import com.common.entity.DataPack;
import com.common.server.view.ServerMainFrame;
import com.common.server.view.ServerProcessThread;
import com.common.server.view.ServiceProcess;
import com.zekai.dao.IExamDetailDao;
import com.zekai.dao.impl.ExamDetailDaoImpl;

public class ExamDetailServiceProcess implements ServiceProcess{

	@Override
	public Object service(DataPack dataPack, ServerProcessThread serverProcessThread, ServerMainFrame serverMainFrame)
			throws IOException {
		IExamDetailDao iExamDetailDao=new ExamDetailDaoImpl();
		if (dataPack.getOptType().equals("getSubDetailName")) {
			List<String> names=iExamDetailDao.getSubDetailName((int)dataPack.getCon());
			serverProcessThread.getOos().writeObject(names);
			serverProcessThread.getOos().flush();
		}else if (dataPack.getOptType().equals("getSubDetailIdByName")) {

			int id=iExamDetailDao.getSubDetailIdByName((String)dataPack.getCon());
			serverProcessThread.getOos().writeObject(id);
			serverProcessThread.getOos().flush();
		}else if (dataPack.getOptType().equals("getNameById")) {
			String name=iExamDetailDao.getNameById((int)dataPack.getCon());
			serverProcessThread.getOos().writeObject(name);
			serverProcessThread.getOos().flush();
		}
		return null;
	}

}
